package com.itheima.day06.test1;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

public class Test1 {
    public static void main(String[] args) {
        List<Student> lists=new ArrayList<Student>();
        Student s1=new Student("小亮",99);
        Student s2=new Student("小强",85);
        Student s3=new Student("小向",90);
        Student s4=new Student("小勇",75);

        Collections.addAll(lists,s1,s2,s3,s4);

        int score=lists.get(0).getScore();
        int index = 0;

        for (int i = 0; i < lists.size(); i++) {
            Student student = lists.get(i);
            if (student.getScore() < score) {
                index=i;
                score=student.getScore();
            }
        }
//        lists.remove(index);
        System.out.println(lists);
        System.out.println("---------");
        Collections.sort(lists,(o1,o2)->o1.getScore()-o2.getScore());
        lists.remove(0);
        System.out.println(lists);
    }
}
